OLS vs WLS: Dealing with heteroskedasticity

Introduction

As you may know, one common strategy to deal with heteroskedasticity in linear regression models (LRM) is to apply Weighted Least Squares (WLS), or perhaps more precisely, Feasible Least Squares.

The idea is that if you believe the variance of your residuals are heteroskedastic, you may do better (be more efficient), if you account for this heteroskedasticity when estimating the model coefficients and standard errors.

The efficiency is gained by giving more weight to parts of the data that would show less dispersion, and less weights to less precise data.

Most of the time, you will find that your OLS and WLS coefficients are comparable, with possibly smaller standard errors with WLS. The question, however, is what happens when the coefficients are different.

A recent Tweet by Prof Wooldridge reminds us that if the model specification is correct, both OLS and WLS are consistent, but WLS is efficient. However, if the model specification is incorrect, OLS and WLS may be different, and neither will be correct.

This raises a simple question. How do we test if OLS and WLS coefficients are equal to each other?

Options

I will start by saying I do not know. But I have a few guesses of how this could be done, which I will show you here. Of course, to do this exercise we need some data.

I will use data that is available online, and that accompanies the Stata command -oaxaca- (by Ben Jann). I ll drop observations without wages

. use http://fmwww.bc.edu/RePEc/bocode/o/oaxaca.dta, clear
(Excerpt from the Swiss Labor Market Survey 1998)

. keep if lnwage!=.
(213 observations deleted)

Let's first start estimating a simple linear regression, and test for heteroskedasticity. For fun I ll use the manual and "canned" approach:

. reg lnwage educ exper tenure female age agesq

      Source |       SS           df       MS      Number of obs   =     1,434
-------------+----------------------------------   F(6, 1427)      =    123.27
       Model |  137.953858         6  22.9923096   Prob > F        =    0.0000
    Residual |  266.165946     1,427  .186521336   R-squared       =    0.3414
-------------+----------------------------------   Adj R-squared   =    0.3386
       Total |  404.119804     1,433  .282009633   Root MSE        =    .43188

------------------------------------------------------------------------------
      lnwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        educ |   .0632923   .0050407    12.56   0.000     .0534043    .0731803
       exper |  -.0002496   .0018009    -0.14   0.890    -.0037824    .0032831
      tenure |   .0062977   .0018946     3.32   0.001     .0025811    .0100142
      female |  -.1508285   .0240651    -6.27   0.000    -.1980353   -.1036217
         age |   .1117635   .0076373    14.63   0.000      .096782     .126745
       agesq |  -.0012397   .0000941   -13.17   0.000    -.0014243    -.001055
       _cons |   .3332218   .1432946     2.33   0.020     .0521312    .6143125
------------------------------------------------------------------------------

. estat hett,   iid rhs

Breusch-Pagan / Cook-Weisberg test for heteroskedasticity 
         Ho: Constant variance
         Variables: educ exper tenure female age agesq

         chi2(6)      =    78.98
         Prob > chi2  =   0.0000

. predict resid, resid

. gen resid2=resid^2

. regress resid2 educ exper tenure female age agesq

      Source |       SS           df       MS      Number of obs   =     1,434
-------------+----------------------------------   F(6, 1427)      =     13.86
       Model |  20.9491241         6  3.49152069   Prob > F        =    0.0000
    Residual |   359.40398     1,427  .251859832   R-squared       =    0.0551
-------------+----------------------------------   Adj R-squared   =    0.0511
       Total |  380.353104     1,433  .265424357   Root MSE        =    .50186

------------------------------------------------------------------------------
      resid2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        educ |  -.0097796   .0058574    -1.67   0.095    -.0212696    .0017105
       exper |  -.0069945   .0020927    -3.34   0.001    -.0110996   -.0028893
      tenure |  -.0027569   .0022016    -1.25   0.211    -.0070756    .0015619
      female |   .1163298   .0279642     4.16   0.000     .0614744    .1711852
         age |  -.0466518   .0088747    -5.26   0.000    -.0640606   -.0292429
       agesq |   .0006592   .0001094     6.03   0.000     .0004447    .0008738
       _cons |   1.093889   .1665118     6.57   0.000     .7672553    1.420524
------------------------------------------------------------------------------

. display "Chi2: `=e(N)*e(r2)'"
Chi2: 78.98198718788628

This clearly shows we have a problem of heteroskedasticity. Thus, to account for this problem, we estimate a model using FGLS.

In other words, we try to model heteroskedasticty first, and obtain a prediction for the conditional heteroskedasticity.

. gen logresid2=log(resid2)

. regress logresid2 educ exper tenure female age agesq

      Source |       SS           df       MS      Number of obs   =     1,434
-------------+----------------------------------   F(6, 1427)      =     17.75
       Model |  557.714322         6   92.952387   Prob > F        =    0.0000
    Residual |  7473.81329     1,427  5.23743048   R-squared       =    0.0694
-------------+----------------------------------   Adj R-squared   =    0.0655
       Total |  8031.52761     1,433  5.60469477   Root MSE        =    2.2885

------------------------------------------------------------------------------
   logresid2 |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        educ |  -.0099415   .0267107    -0.37   0.710     -.062338     .042455
       exper |   -.033365   .0095431    -3.50   0.000    -.0520851   -.0146449
      tenure |  -.0081768   .0100396    -0.81   0.416    -.0278708    .0115172
      female |   .6484603   .1275212     5.09   0.000     .3983111    .8986095
         age |  -.2660638   .0404701    -6.57   0.000     -.345451   -.1866765
       agesq |   .0036293   .0004988     7.28   0.000     .0026509    .0046078
       _cons |   1.285756   .7593196     1.69   0.091    -.2037467    2.775258
------------------------------------------------------------------------------

. predictnl h_x=exp(xb())

And re-estimate the model using WLS, or using transformed data:

. qui:reg lnwage educ exper tenure female age agesq 

. est sto mols

. qui:reg lnwage educ exper tenure female age agesq [aw=1/h_x]

. est sto mwls

. foreach i in lnwage educ exper tenure female age agesq  {
  2.         gen `i'w=`i'*sqrt(1/h_x)
  3. }

. gen one =sqrt(1/h_x)

. qui:reg lnwagew educw experw tenurew femalew agew agesqw one, nocons

. est sto mtls

. esttab mols mwls mtls,se nogaps b(4) mtitle(ols wls tls)

------------------------------------------------------------
                      (1)             (2)             (3)   
                      ols             wls             tls   
------------------------------------------------------------
educ               0.0633***       0.0558***                
                 (0.0050)        (0.0044)                   
exper             -0.0002         -0.0015                   
                 (0.0018)        (0.0017)                   
tenure             0.0063***       0.0033*                  
                 (0.0019)        (0.0015)                   
female            -0.1508***      -0.1537***                
                 (0.0241)        (0.0218)                   
age                0.1118***       0.0976***                
                 (0.0076)        (0.0082)                   
agesq             -0.0012***      -0.0011***                
                 (0.0001)        (0.0001)                   
educw                                              0.0558***
                                                 (0.0044)   
experw                                            -0.0015   
                                                 (0.0017)   
tenurew                                            0.0033*  
                                                 (0.0015)   
femalew                                           -0.1537***
                                                 (0.0218)   
agew                                               0.0976***
                                                 (0.0082)   
agesqw                                            -0.0011***
                                                 (0.0001)   
one                                                0.7189***
                                                 (0.1615)   
_cons              0.3332*         0.7189***                
                 (0.1433)        (0.1615)                   
------------------------------------------------------------
N                    1434            1434            1434   
------------------------------------------------------------
Standard errors in parentheses
* p<0.05, ** p<0.01, *** p<0.001

And as we know, the WLS and the one using transformed data, provide exactly the same results.

Now, if you look into columns 1 and 2 of the above table, you will see some differences in coefficients. Those differences seem small, but are they statistically different? In other words:

How do we compare WLS vs OLS coefficients?

One option that was suggested is using a Hausman test, where ols will be considered consistent, and wls efficient:

. hausman mols mwls

                 ---- Coefficients ----
             |      (b)          (B)            (b-B)     sqrt(diag(V_b-V_B))
             |      mols         mwls        Difference          S.E.
-------------+----------------------------------------------------------------
        educ |    .0632923     .0557789        .0075134        .0024064
       exper |   -.0002496    -.0014931        .0012435        .0006326
      tenure |    .0062977     .0032773        .0030204        .0011022
      female |   -.1508285    -.1536601        .0028316        .0101524
         age |    .1117635     .0975919        .0141716               .
       agesq |   -.0012397    -.0010556       -.0001841               .
------------------------------------------------------------------------------
                         b = consistent under Ho and Ha; obtained from regress
          B = inconsistent under Ha, efficient under Ho; obtained from regress

    Test:  Ho:  difference in coefficients not systematic

                  chi2(6) = (b-B)'[(V_b-V_B)^(-1)](b-B)
                          =   -10.54    chi2<0 ==> model fitted on these
                                        data fails to meet the asymptotic
                                        assumptions of the Hausman test;
                                        see suest for a generalized test

But this seems to violate the assumptions behind the test, which is why it is providing an unexpected chi2 statistic.

Following the output suggestion, we could try -suest-, and obtain simultaneous coefficients, but it will provide an error because of the different weighting schemes.

. suest mols mwls
inconsistent weighting types
r(322);

We could, of course Estimate the standard OLS with the WLS that uses the transformed data simultaneously:

. suest mols mtls 

Simultaneous results for mols, mtls

                                                Number of obs     =      1,434

------------------------------------------------------------------------------
             |               Robust
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
mols_mean    |
        educ |   .0632923   .0055389    11.43   0.000     .0524362    .0741485
       exper |  -.0002496   .0018166    -0.14   0.891      -.00381    .0033108
      tenure |   .0062977   .0017927     3.51   0.000      .002784    .0098114
      female |  -.1508285    .023121    -6.52   0.000    -.1961449   -.1055121
         age |   .1117635   .0100211    11.15   0.000     .0921226    .1314044
       agesq |  -.0012397   .0001238   -10.01   0.000    -.0014824   -.0009969
       _cons |   .3332218   .1985962     1.68   0.093    -.0560195    .7224632
-------------+----------------------------------------------------------------
mols_lnvar   |
       _cons |   -1.67921   .0729404   -23.02   0.000     -1.82217   -1.536249
-------------+----------------------------------------------------------------
mtls_mean    |
       educw |   .0557789   .0051134    10.91   0.000     .0457569     .065801
      experw |  -.0014931   .0016149    -0.92   0.355    -.0046583     .001672
     tenurew |   .0032773   .0016189     2.02   0.043     .0001043    .0064502
     femalew |  -.1536601   .0216294    -7.10   0.000     -.196053   -.1112673
        agew |   .0975919   .0083043    11.75   0.000     .0813158    .1138679
      agesqw |  -.0010556   .0001005   -10.50   0.000    -.0012526   -.0008585
         one |   .7188607   .1612016     4.46   0.000     .4029114     1.03481
-------------+----------------------------------------------------------------
mtls_lnvar   |
       _cons |   1.580521   .0658601    24.00   0.000     1.451437    1.709604
------------------------------------------------------------------------------

. test ([mols_mean]educ=[mtls_mean]educw) ([mols_mean]exper=[mtls_mean]experw) ///
>         ([mols_mean]tenure=[mtls_mean]tenurew) ([mols_mean]female=[mtls_mean]femalew) ///
>         ([mols_mean]age=[mtls_mean]agew) ([mols_mean]agesq=[mtls_mean]agesqw) ///
>         ([mols_mean]_cons=[mtls_mean]one)  

 ( 1)  [mols_mean]educ - [mtls_mean]educw = 0
 ( 2)  [mols_mean]exper - [mtls_mean]experw = 0
 ( 3)  [mols_mean]tenure - [mtls_mean]tenurew = 0
 ( 4)  [mols_mean]female - [mtls_mean]femalew = 0
 ( 5)  [mols_mean]age - [mtls_mean]agew = 0
 ( 6)  [mols_mean]agesq - [mtls_mean]agesqw = 0
 ( 7)  [mols_mean]_cons - [mtls_mean]one = 0

           chi2(  7) =   32.11
         Prob > chi2 =    0.0000

This approach suggests that the differences between OLS and WLS are different from each other. But let's continue.

Then we have a strategy suggested by Alan, which redirected me to a strategy proposed by Justin McCrary. This can be found Here .

This strategy suggests estimating an auxiliary regression, with the original and transformed variables data, and test if the transformed variables are statistically different from zero.

Here the transformation is slightly different from the previous one:

. foreach i in   educ exper tenure female age agesq  {
  2.         gen `i'z=`i'*(1/h_x)
  3. }

. gen onez =(1/h_x)

. 
. reg lnwage educ exper tenure female age agesq  educz experz tenurez femalez agez agesqz onez, robust

Linear regression                               Number of obs     =      1,434
                                                F(13, 1420)       =      50.98
                                                Prob > F          =     0.0000
                                                R-squared         =     0.3554
                                                Root MSE          =     .42829

------------------------------------------------------------------------------
             |               Robust
      lnwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
        educ |   .0844527   .0135289     6.24   0.000     .0579139    .1109915
       exper |   .0061548   .0135858     0.45   0.651    -.0204956    .0328053
      tenure |   .0153234   .0060056     2.55   0.011     .0035425    .0271043
      female |  -.1162305    .232304    -0.50   0.617    -.5719263    .3394653
         age |   .1480491   .0908262     1.63   0.103    -.0301189     .326217
       agesq |  -.0017282   .0012511    -1.38   0.167    -.0041825     .000726
       educz |  -.0006218   .0003432    -1.81   0.070     -.001295    .0000514
      experz |  -.0000361   .0003262    -0.11   0.912    -.0006759    .0006037
     tenurez |  -.0001932   .0000879    -2.20   0.028    -.0003657   -.0000207
     femalez |  -.0034715   .0074404    -0.47   0.641    -.0180669    .0111239
        agez |  -.0007484   .0028858    -0.26   0.795    -.0064093    .0049125
      agesqz |   8.19e-06   .0000385     0.21   0.831    -.0000673    .0000837
        onez |   .0231248   .0740897     0.31   0.755    -.1222122    .1684617
       _cons |  -.5641893   .9176907    -0.61   0.539    -2.364364    1.235986
------------------------------------------------------------------------------

. est sto mcry

. test educz  experz  tenurez  femalez  agez  agesqz onez

 ( 1)  educz = 0
 ( 2)  experz = 0
 ( 3)  tenurez = 0
 ( 4)  femalez = 0
 ( 5)  agez = 0
 ( 6)  agesqz = 0
 ( 7)  onez = 0

       F(  7,  1420) =    5.05
            Prob > F =    0.0000

This approach also suggest that WLS and OLS coefficients may be different. The statistic, however, its quite smaller than the -suest- approach.

Then, we have an strategy that would use "cloned" data. This is the general procedure:

. gen id=_n

. expand 2, gen(clone)
(1,434 observations created)

. gen wgt=1 if clone==0
(1,434 missing values generated)

. replace wgt=(1/h_x) if clone==1
(1,434 real changes made)

. 
. reg lnwage c.(educ exper tenure female age agesq)##i.clone [w=wgt], cluster(id)
(analytic weights assumed)
(sum of wgt is 54,732.3570792675)

Linear regression                               Number of obs     =      2,868
                                                F(13, 1433)       =      48.47
                                                Prob > F          =     0.0000
                                                R-squared         =     0.2875
                                                Root MSE          =     .36353

                                   (Std. Err. adjusted for 1,434 clusters in id)
--------------------------------------------------------------------------------
               |               Robust
        lnwage |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
---------------+----------------------------------------------------------------
          educ |   .0632923   .0055515    11.40   0.000     .0524023    .0741823
         exper |  -.0002496   .0018207    -0.14   0.891    -.0038211    .0033219
        tenure |   .0062977   .0017968     3.50   0.000      .002773    .0098223
        female |  -.1508285   .0231736    -6.51   0.000    -.1962864   -.1053706
           age |   .1117635   .0100438    11.13   0.000     .0920613    .1314657
         agesq |  -.0012397   .0001241    -9.99   0.000    -.0014832   -.0009962
       1.clone |   .3856386   .1029495     3.75   0.000     .1836907    .5875865
               |
  clone#c.educ |
            1  |  -.0075134   .0029883    -2.51   0.012    -.0133752   -.0016515
               |
 clone#c.exper |
            1  |  -.0012435   .0010555    -1.18   0.239    -.0033141    .0008271
               |
clone#c.tenure |
            1  |  -.0030204   .0010812    -2.79   0.005    -.0051412   -.0008996
               |
clone#c.female |
            1  |  -.0028316   .0113549    -0.25   0.803    -.0251057    .0194425
               |
   clone#c.age |
            1  |  -.0141716   .0053047    -2.67   0.008    -.0245774   -.0037659
               |
 clone#c.agesq |
            1  |   .0001841   .0000692     2.66   0.008     .0000484    .0003199
               |
         _cons |   .3332218    .199048     1.67   0.094    -.0572348    .7236785
--------------------------------------------------------------------------------

. test 1.clone#c.educ  1.clone#c.exper 1.clone#c.tenure 1.clone#c.female 1.clone#c.age 1.clone#c.agesq 1.clone

 ( 1)  1.clone#c.educ = 0
 ( 2)  1.clone#c.exper = 0
 ( 3)  1.clone#c.tenure = 0
 ( 4)  1.clone#c.female = 0
 ( 5)  1.clone#c.age = 0
 ( 6)  1.clone#c.agesq = 0
 ( 7)  1.clone = 0

       F(  7,  1433) =    4.57
            Prob > F =    0.0000

This approach is almost identical to the suest approach I described before. And it also suggests that WLS and OLS coefficients may be different, and the

Other less conventional methods involve, for example, the use of simulation methods, specifically bootstrap. But here, we would also have two options.

1. Should WLS weights be treated as exogenous and fix?
2. or Should they be treated as endogenous for the estimation of the variance-covariance matrix

So Let's try both:

. keep if clone==0
(1,434 observations deleted)

. 
. program bs_wls_ols, eclass
  1.         reg lnwage educ exper tenure female age agesq 
  2.         matrix b1=e(b)
  3.         capture drop lres
  4.         predictnl lres=log((lnwage-xb())^2) 
  5.         reg lres educ exper tenure female age agesq
  6.         capture drop nwgt
  7.         predictnl nwgt=1/exp(xb())
  8.         ** two steps assuming Weights change
.         reg lnwage educ exper tenure female age agesq  [w=nwgt]
  9.         matrix b2=e(b)
 10.         ** two steps assuming Weights do not change
.         reg lnwage educ exper tenure female age agesq  [w=1/h_x]
 11.         matrix b3=e(b)
 12.         ** Finally the differences
.         matrix db2=b1-b2
 13.         matrix db3=b1-b3
 14.         ** putting all together:
.         matrix coleq b2= wols_dw
 15.         matrix coleq b3= wols_fw
 16.         matrix coleq db2= dwols_dw
 17.         matrix coleq db3= dwols_fw
 18.         matrix b=b2,b3,db2,db3
 19.         ereturn post b
 20. end

. 
. bootstrap, reps(500) seed(10) nodots: bs_wls_ols

warning: Because bs_wls_ols is not an estimation command or does not set e(sample), bootstrap has no way to determine which observations
         are used in calculating the statistics and so assumes that all observations are used. This means that no observations will be
         excluded from the resampling because of missing values or other reasons.

         If the assumption is not true, press Break, save the data, and drop the observations that are to be excluded. Be sure that the
         dataset in memory contains only the relevant data.

Bootstrap results                               Number of obs     =      1,434
                                                Replications      =        500

------------------------------------------------------------------------------
             |   Observed   Bootstrap                         Normal-based
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
wols_dw      |
        educ |   .0557789   .0052471    10.63   0.000     .0454948    .0660631
       exper |  -.0014931   .0016966    -0.88   0.379    -.0048185    .0018322
      tenure |   .0032773   .0015997     2.05   0.040     .0001418    .0064127
      female |  -.1536601   .0249396    -6.16   0.000    -.2025408   -.1047795
         age |   .0975919   .0076928    12.69   0.000     .0825143    .1126694
       agesq |  -.0010556   .0000949   -11.12   0.000    -.0012416   -.0008695
       _cons |   .7188605     .14182     5.07   0.000     .4408984    .9968225
-------------+----------------------------------------------------------------
wols_fw      |
        educ |   .0557789   .0049635    11.24   0.000     .0460507    .0655072
       exper |  -.0014931   .0015841    -0.94   0.346    -.0045978    .0016116
      tenure |   .0032773   .0015943     2.06   0.040     .0001524    .0064021
      female |  -.1536601   .0220556    -6.97   0.000    -.1968883    -.110432
         age |   .0975919   .0084292    11.58   0.000      .081071    .1141128
       agesq |  -.0010556   .0001011   -10.44   0.000    -.0012537   -.0008574
       _cons |   .7188605   .1625665     4.42   0.000     .4002361    1.037485
-------------+----------------------------------------------------------------
dwols_dw     |
        educ |   .0075134   .0037221     2.02   0.044     .0002183    .0148085
       exper |   .0012435   .0011646     1.07   0.286     -.001039    .0035261
      tenure |   .0030204   .0012056     2.51   0.012     .0006576    .0053833
      female |   .0028316   .0130083     0.22   0.828    -.0226643    .0283275
         age |   .0141716   .0079227     1.79   0.074    -.0013566    .0296999
       agesq |  -.0001841   .0000976    -1.89   0.059    -.0003754    7.16e-06
       _cons |  -.3856386   .1633829    -2.36   0.018    -.7058632    -.065414
-------------+----------------------------------------------------------------
dwols_fw     |
        educ |   .0075134   .0030341     2.48   0.013     .0015666    .0134602
       exper |   .0012435   .0010892     1.14   0.254    -.0008913    .0033783
      tenure |   .0030204   .0010329     2.92   0.003     .0009959     .005045
      female |   .0028316    .011126     0.25   0.799     -.018975    .0246383
         age |   .0141716   .0052768     2.69   0.007     .0038292    .0245141
       agesq |  -.0001841    .000067    -2.75   0.006    -.0003155   -.0000527
       _cons |  -.3856386   .1033199    -3.73   0.000     -.588142   -.1831353
------------------------------------------------------------------------------

A few things to notice here.

. test [dwols_fw]educ  [dwols_fw]exper [dwols_fw]tenure [dwols_fw]female [dwols_fw]age [dwols_fw]agesq

 ( 1)  [dwols_fw]educ = 0
 ( 2)  [dwols_fw]exper = 0
 ( 3)  [dwols_fw]tenure = 0
 ( 4)  [dwols_fw]female = 0
 ( 5)  [dwols_fw]age = 0
 ( 6)  [dwols_fw]agesq = 0

           chi2(  6) =   29.33
         Prob > chi2 =    0.0001

. test [dwols_dw]educ  [dwols_dw]exper [dwols_dw]tenure [dwols_dw]female [dwols_dw]age [dwols_dw]agesq

 ( 1)  [dwols_dw]educ = 0
 ( 2)  [dwols_dw]exper = 0
 ( 3)  [dwols_dw]tenure = 0
 ( 4)  [dwols_dw]female = 0
 ( 5)  [dwols_dw]age = 0
 ( 6)  [dwols_dw]agesq = 0

           chi2(  6) =   14.46
         Prob > chi2 =    0.0249

And finally, we can also try estimating both equations simultaneously, using -ml-, adding weights to the objective function manually:

. program myolswls1
  1.         args lnf xb1 xb2
  2.         qui: {
  3.                 * OLS regression:
.                 replace `lnf' = -($ML_y1-`xb1')^2
  4.                 * WLS where weights are added "manually"
.                 replace `lnf' = `lnf'-(1/h_x)*($ML_y2-`xb2')^2
  5.         }
  6. end

. ml model lf myolswls1 (ols:lnwage = educ exper tenure female age agesq) ///
>                                      (wls:lnwage = educ exper tenure female age agesq)  , robust maximize

initial:       log pseudolikelihood = -659054.43
alternative:   log pseudolikelihood = -484273.57
rescale:       log pseudolikelihood = -27060.519
rescale eq:    log pseudolikelihood = -27060.519
Iteration 0:   log pseudolikelihood = -27060.519  
Iteration 1:   log pseudolikelihood = -7200.3363  
Iteration 2:   log pseudolikelihood = -7197.7961  
Iteration 3:   log pseudolikelihood = -7197.7961  

. ml display

                                                Number of obs     =      1,434
                                                Wald chi2(6)      =     506.14
Log pseudolikelihood = -7197.7961               Prob > chi2       =     0.0000

------------------------------------------------------------------------------
             |               Robust
             |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
ols          |
        educ |   .0632923   .0055389    11.43   0.000     .0524362    .0741485
       exper |  -.0002496   .0018166    -0.14   0.891      -.00381    .0033108
      tenure |   .0062977   .0017927     3.51   0.000      .002784    .0098114
      female |  -.1508285    .023121    -6.52   0.000    -.1961449   -.1055121
         age |   .1117635   .0100211    11.15   0.000     .0921226    .1314044
       agesq |  -.0012397   .0001238   -10.01   0.000    -.0014824   -.0009969
       _cons |   .3332218   .1985962     1.68   0.093    -.0560195    .7224632
-------------+----------------------------------------------------------------
wls          |
        educ |   .0557789   .0051134    10.91   0.000     .0457569     .065801
       exper |  -.0014931   .0016149    -0.92   0.355    -.0046583     .001672
      tenure |   .0032773   .0016189     2.02   0.043     .0001043    .0064502
      female |  -.1536601   .0216294    -7.10   0.000     -.196053   -.1112673
         age |   .0975919   .0083043    11.75   0.000     .0813158    .1138679
       agesq |  -.0010556   .0001005   -10.50   0.000    -.0012526   -.0008585
       _cons |   .7188605   .1612016     4.46   0.000     .4029112     1.03481
------------------------------------------------------------------------------

But this adds nothing else to the above tests, because the results are similar to the -suest- approach.

. test [ols=wls]

 ( 1)  [ols]educ - [wls]educ = 0
 ( 2)  [ols]exper - [wls]exper = 0
 ( 3)  [ols]tenure - [wls]tenure = 0
 ( 4)  [ols]female - [wls]female = 0
 ( 5)  [ols]age - [wls]age = 0
 ( 6)  [ols]agesq - [wls]agesq = 0

           chi2(  6) =   30.39
         Prob > chi2 =    0.0000

Conclusion

So how do we test if WLS and OLS coefficients are statistically different from each other??

My conclusion is, I do not know.

And unfortunately, I have not seen any procedures or suggestions of tests for this in any of the books I have at hand. Nevertheless, After trying a few possible procedures, they all indicate that OLS and WLS coefficients, in the current example, are different.

In fact, all tests rely on "duplicating" the data, or in effect estimating WLS and OLS simultaneously, lead to the same conclusions. I wonder, however, if there are other (better) procedures to run this simple test.

Comments welcome